/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ysw.action;

import static com.opensymphony.xwork2.Action.SUCCESS;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import ysw.jdbc.SendJdbc;
import ysw.vo.Send;

/**
 *
 * @author Administrator
 */
public class SendAction  extends ActionSupport {
    private Send send;

    public Send getSend() {
        return send;
    }

    public void setSend(Send send) {
        this.send = send;
    }
    
      private List<Send> sendList;
    public String execute() throws Exception{
       SendJdbc sendJ=new SendJdbc();
        
        send.setEid(send.getEid());
        send.setEname(send.getEname());
         send.setEphone(send.getEphone());
         send.setCarnumber(send.getCarnumber());
        send.setStime(send.getStime());
        
        send.setFinish(send.getFinish());
  
            
     
       sendJ.addSend(send);
        return SUCCESS;
    }
    

public String showAllSend(){
     
	  Send send=new Send();
 SendJdbc sendJ=new SendJdbc(); 
        try{
            sendList=sendJ.showSend();
        }catch(SQLException e){
            e.printStackTrace();
        }
     
	Map request=(Map)ActionContext.getContext().get("request");
        request.put("sendList",sendList);
        return SUCCESS;
    }

public String showOneSend() throws Exception{
    Send send1=new Send();
    SendJdbc sendJ=new SendJdbc(); 
    send1=sendJ.showOneSend(send.getId());
    Map request=(Map)ActionContext.getContext().get("request");
    request.put("send1",send1);
    return SUCCESS;
}

public String updateSaveSend() throws Exception{
     SendJdbc sendJ=new SendJdbc(); 
     
         send.setId(send.getId());
         send.setEid(send.getEid());
        send.setEname(send.getEname());
         send.setEphone(send.getEphone());
         send.setCarnumber(send.getCarnumber());
        send.setStime(send.getStime());
      
        send.setFinish(send.getFinish());
     
            sendJ.updateSaveSend(send);
    return SUCCESS;
}
}
